package net.zoneland.greenleaf;

import java.io.UnsupportedEncodingException;

import javax.servlet.ServletContext;

import net.zoneland.greenleaf.common.properties.PropertiesUtil;
import net.zoneland.greenleaf.common.worktimehelper.TimeManager;

import org.springframework.web.context.WebApplicationContext;

public class GLOBAL {
	public static final String APP_VERSION = PropertiesUtil.getProperties("config","app_version");
	public static final String DEFAULT_PASSWORD = PropertiesUtil.getProperties("config","default_password");
	public static final String LOGIN_INDEX = PropertiesUtil.getProperties("config","loginIndex");
	public static final String SYSTEM_PROVINDE_CODE = PropertiesUtil.getProperties("config","global.system_provinde_code");
	private static final String SYSTEM_PROVINDE_NAME = PropertiesUtil.getProperties("config","global.system_provinde_name");
	public static final String SYSTEM_CITY_CODE = PropertiesUtil.getProperties("config","global.system_city_code");
	private static final String SYSTEM_CITY_NAME = PropertiesUtil.getProperties("config","global.system_city_name");
	public static WebApplicationContext springContext = null;
	public static ServletContext servletContext = null;
	public static TimeManager timeManager = null;
	
	public static String getSystemProvinceName() throws UnsupportedEncodingException {
		if( SYSTEM_PROVINDE_NAME != null && !SYSTEM_PROVINDE_NAME.isEmpty() ) {
			return new String( SYSTEM_PROVINDE_NAME.getBytes("ISO-8859-1"), "UTF-8" );
		}else {
			return "未知省份";
		}
	}
	
	public static String getSystemCityName() throws UnsupportedEncodingException {
		if( SYSTEM_CITY_NAME != null && !SYSTEM_CITY_NAME.isEmpty() ) {
			return new String( SYSTEM_CITY_NAME.getBytes("ISO-8859-1"), "UTF-8" );
		}else {
			return "未知城市";
		}
	}
	
}